//
//  ICChatMessageConferenceCell.m
//  ICome
//
//  Created by zhangrongwu on 2017/7/8.
//  Copyright © 2017年 iCom. All rights reserved.
//

#import "ICChatMessageConferenceCell.h"
#import "ICConferenceButton.h"
#import "ICHeaderFile.h"
@interface ICChatMessageConferenceCell ()

@property (nonatomic, strong) ICConferenceButton *conferenceButton;

@end
@implementation ICChatMessageConferenceCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.conferenceButton];
    }
    return self;
}

- (void)setModelFrame:(ICMessageFrame *)modelFrame
{
    [super setModelFrame:modelFrame];
    
    self.conferenceButton.frame = modelFrame.picViewF;
    self.conferenceButton.messageModel = modelFrame.model;
}

#pragma mark - Event

- (void)confeBtnClicked
{
    NSDictionary *dict = [NSDictionary dictionaryWithJsonString:self.modelFrame.model.message.fileKey];
    NSString *url = [NSString stringWithFormat:@"icome://videoconf?vcId=%@", dict[@"vcId"]]; // 进入视频会议
    
    [self routerEventWithName:GXRouterEventURLSkip
                     userInfo:@{MessageKey:self.modelFrame,
                                    @"url":url}];
}

#pragma mark - Getter

- (ICConferenceButton *)conferenceButton
{
    if (!_conferenceButton) {
        _conferenceButton = [ICConferenceButton buttonWithType:UIButtonTypeCustom];
        [_conferenceButton addTarget:self action:@selector(confeBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    }
    return _conferenceButton;
}


@end
